package Day04;

import java.util.Scanner;

public class WhileDemo {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int i=1,n=1,num=(int)(1+1000*Math.random()),guess;


        for (int i2 = 1;i2<=5;i2++){
            System.out.println("行动是成功的阶梯");
        }

        while (i<=9){
            n = 1;
            while (n<=i){
                System.out.print(n+"*"+i+"="+(i*n)+"\t");
                n++;
            }
            System.out.println();
            i++;
        }

        System.out.println(num);

//        System.out.println("请输入猜测数字:");
//        guess = sc.nextInt();

//        while (guess != num){
//            if(guess > num){
//                System.out.println("大了");
//            }else{
//                System.out.println("小了");
//            }
//            System.out.println("请输入猜测数字:");
//            guess = sc.nextInt();
//
//
//        };
//        System.out.println("猜对了");


//        do{
//            System.out.println("请输入猜测数字:");
//            guess = sc.nextInt();
//            if(guess > num){
//                System.out.println("大了");
//            }else if(guess <num){
//                System.out.println("小了");
//            }
//
//        }while (guess != num);
//        System.out.println("猜对了");

        //自建死循环
        while (true){
            System.out.println("请输入猜测数字:");
            guess = sc.nextInt();
            if(guess > num){
                System.out.println("大了");
            }else if(guess <num){
                System.out.println("小了");
            }else {
                System.out.println("恭喜你猜对了");
                break;
            }
        }




    }

}
